/**
 * 文件描述如下：
 * 1. 设备驱动页面的数据
 */

// 处理交通流量页面的数据

const data_1 = {
  title: '融合',
  data: [
    {
      id: 0,
      key: 'compress-img-w',
      parentNode: null,
      name: '输入相机的尺寸宽',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 1,
      key: 'compress-img-h',
      parentNode: null,
      name: '输入相机的尺寸高',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 2,
      key: 'original-img-w',
      parentNode: null,
      name: '相机原始尺寸宽',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 3,
      key: 'original-img-h',
      parentNode: null,
      name: '相机原始尺寸高',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 4,
      key: 'angle0',
      parentNode: null,
      name: '相机0对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 5,
      key: 'angle1',
      parentNode: null,
      name: '相机1对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 6,
      key: 'angle2',
      parentNode: null,
      name: '相机2对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 7,
      key: 'angle3',
      parentNode: null,
      name: '相机3对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 8,
      key: 'angle4',
      parentNode: null,
      name: '相机4对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 9,
      key: 'angle5',
      parentNode: null,
      name: '相机5对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 10,
      key: 'angle6',
      parentNode: null,
      name: '相机6对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 11,
      key: 'angle7',
      parentNode: null,
      name: '相机7对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 12,
      key: 'angle8',
      parentNode: null,
      name: '相机8对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 13,
      key: 'angle9',
      parentNode: null,
      name: '相机9对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 14,
      key: 'angle10',
      parentNode: null,
      name: '相机10对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 15,
      key: 'angle11',
      parentNode: null,
      name: '相机11对应的角度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 15,
      key: 'ground-height',
      parentNode: null,
      name: '地面高度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 16,
      key: 'video-class',
      parentNode: null,
      name: '视频检测类别',
      arr: [],
      showType: 'eidtArr',
      inputType: 'text',
    },
    {
      id: 17,
      key: 'conf-threshold',
      parentNode: null,
      name: '每个类别置信度阈值',
      arr: [],
      showType: 'eidtArr',
      inputType: 'object',
    },
    {
      id: 18,
      key: 'class-size',
      parentNode: null,
      name: '不同类别对应的尺寸信息',
      arr: [],
      showType: 'eidtArr',
      inputType: 'objectArr',
    },
  ],
}

const data_2 = {
  title: '跟踪',
  data: [
    {
      id: 0,
      key: 'use-track',
      parentNode: null,
      name: '使用跟踪的开关',
      showType: 'switch',
      inputType: 'switch',
    },
    {
      id: 1,
      key: 'track-type',
      parentNode: null,
      name: '跟踪模式',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 2,
      key: 'm-min-hits',
      parentNode: null,
      name: '最小击中次数',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 3,
      key: 'max-age',
      parentNode: null,
      name: '最大未跟踪帧数',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 4,
      key: 'max-iou-distance',
      parentNode: null,
      name: 'IOU匹配阈值',
      showType: 'input',
      inputType: 'double',
    },
  ],
}

const data_3 = {
  title: '质心调整',
  data: [
    {
      id: 0,
      key: 'camera-id',
      parentNode: null,
      name: '相机ID',
      arr: [],
      showType: 'eidtArr',
      inputType: 'text',
    },
    {
      id: 1,
      key: 'big-labels',
      parentNode: null,
      name: '大车目标类别',
      arr: [],
      showType: 'eidtArr',
      inputType: 'text',
    },
    {
      id: 2,
      key: 'm-min-hits',
      parentNode: null,
      name: '最小击中次数',
      showType: 'input',
      inputType: 'uint',
    },
    {
      id: 3,
      key: 'camera-fix-0',
      parentNode: null,
      name: '质心0',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 4,
      key: 'camera-fix-1',
      parentNode: null,
      name: '质心1',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 5,
      key: 'camera-fix-2',
      parentNode: null,
      name: '质心2',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 6,
      key: 'camera-fix-3',
      parentNode: null,
      name: '质心3',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 7,
      key: 'camera-fix-4',
      parentNode: null,
      name: '质心4',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 8,
      key: 'camera-fix-5',
      parentNode: null,
      name: '质心5',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 9,
      key: 'camera-fix-6',
      parentNode: null,
      name: '质心6',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 10,
      key: 'camera-fix-7',
      parentNode: null,
      name: '质心7',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 11,
      key: 'camera-fix-8',
      parentNode: null,
      name: '质心8',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 12,
      key: 'camera-fix-9',
      parentNode: null,
      name: '质心9',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 13,
      key: 'camera-fix-10',
      parentNode: null,
      name: '质心10',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
    {
      id: 14,
      key: 'camera-fix-11',
      parentNode: null,
      name: '质心11',
      arr: [],
      showType: 'numArr',
      inputType: ['arr', 'arr', 'arr', 'arr', 'arr'],
    },
  ],
}

const data_main3 = [data_1, data_2, data_3]

export const dataProcessing_pre_3 = (params) => {
  if (!params) return
  // 头部的块
  data_main3.forEach((ele) => {
    const data = ele.data
    data.forEach((item) => {
      if (item.arr) {
        item.arr = item.parentNode ? params[item.parentNode][item.key] : params[item.key]
      }
      item.value = item.parentNode ? params[item.parentNode][item.key] : params[item.key]
    })
  })

  return { data_main3 }
}
